class code2 {
    //方法一：选or不选
    public List<List<Integer>> ret;
    public List<Integer> path;
    public List<List<Integer>> subsets(int[] nums) {
        ret = new ArrayList<>();
        path = new ArrayList<>();
        dfs(nums,0);
        return ret;
    }
    public void dfs(int[] nums,int pos) {
        if(pos==nums.length) {
            ret.add(new ArrayList<>(path));
            return;
        }
        //选
        path.add(nums[pos]);
        dfs(nums,pos+1);
        path.remove(path.size()-1);
        //不选
        dfs(nums,pos+1);

    }
}